package pl.maciejziarko.mshare.security;

import org.apache.commons.lang.RandomStringUtils;
import org.springframework.stereotype.Component;

import java.math.BigInteger;
import java.security.SecureRandom;

/**
 * @author Maciej Ziarko
 */
@Component
public class SimpleSaltGenerator implements SaltGenerator {
    
    public static final int DEFAULT_SALT_LENGTH = 64;
    
    private int length;

    public SimpleSaltGenerator() {
        this.length = DEFAULT_SALT_LENGTH;
    }

    public SimpleSaltGenerator(int length) {
        this.length = length;
    }

    @Override
    public String generateSalt() {
        return RandomStringUtils.randomAscii(length);
    }
}
